﻿class as.loadPic 
{
	public function loadPic(ob:MovieClip, uri:String, onStart:Function,onProcess:Function,onComplete:Function,onError:Function){
		var mcldr = new MovieClipLoader();
		var ldrob = new Object();
		
		ldrob.onLoadStart = function(tmc) {
			onStart(tmc);
		}
			
		ldrob.onLoadProgress = function(tmc, loadedBytes, totalBytes) {
			onProcess(loadedBytes,totalBytes);
		}
			
		ldrob.onLoadComplete = function(tmc,httpstatus) {
			onComplete(tmc,httpstatus);
			removeMovieClip(tmc);//////////
		}
			
		ldrob.onLoadInit = function(tmc) {
			//onStart(tmc);
			//removeMovieClip(tmc);
		}
		
		ldrob.onLoadError = function(tmc, errorCode,httpstatus){
			onError(tmc,errorCode,httpstatus);
		}
		
		mcldr.addListener(ldrob);
		mcldr.loadClip(uri, ob);
	}
}